import Cookies from 'js-cookie'
// import * as types from '../types'
import axios from 'axios'

const state = {

}

const mutations = {
  logout(state, vm) {
    Cookies.remove('user')
    localStorage.clear()
  }
}

const getters = {

}

const actions = {
  async loadUser({
    commit
  }, data) {
    const response = await axios.get('/vts/user/get?code=' + data.code)
    if (response.status === 200) data.callback(response.data)
  }
}

export default {
  state,
  mutations,
  actions,
  getters
}
